//
// Created by liang on 2020/8/29.
//

#ifndef CUDA_PROJECT_SAMPLING_H
#define CUDA_PROJECT_SAMPLING_H

#include <math.h>
#include <stdio.h>
#include <iostream>
//cuda
#include "cuda_runtime.h"
#include  "cuda_runtime_api.h"
#include "cuda.h"
#include "device_launch_parameters.h"

//libtorch
#include "torch/serialize/tensor.h"
#include <ATen/ATen.h>
#include "c10/util/ArrayRef.h"
#include <ATen/cuda/CUDAContext.h>
//math

#include "vector"
#include <cmath>

//#include "NumCpp.hpp" //


//used for cuda
#include <THC/THC.h>//treath used
#define TOTAL_THREADS 1024
#define THREADS_PER_BLOCK 256
#define DIVUP(m,n) ((m) / (n) + ((m) % (n) > 0))

//used for reading the pointcloud of bin format
//#include <pcl/io/pcd_io.h>
//#include <pcl/io/ply_io.h>
//#include <pcl/point_types.h>
//#include <pcl/common/io.h>
//#include <pcl/impl/point_types.hpp>
//#include <pcl/point_cloud.h>


void add_cuda(torch::Tensor &a,torch::Tensor &b,torch::Tensor &c);

void AddLaunch(const float *a,const float *b,float *c, int size[],cudaStream_t stream);
void gather_points_kernel_launcher_fast(int b, int c, int n, int npoints,
                                        const float *points, const int *idx, float *out, cudaStream_t stream);
int gather_points_wrapper_fast(int b, int c, int n, int npoints,
                               at::Tensor points_tensor, at::Tensor idx_tensor, at::Tensor out_tensor);

int furthest_point_sampling_wrapper(int b, int n, int m,
                                at::Tensor points_tensor, at::Tensor temp_tensor, at::Tensor idx_tensor);

void furthest_point_sampling_kernel_launcher(int b, int n, int m,
                                             const float *dataset, float *temp, int *idxs, cudaStream_t stream);


#endif //CUDA_PROJECT_SAMPLING_H
